home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / champion.swf / scripts / frame_3 / PlaceObject2_41_2 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2008-11-13  |  1.9 KB  |  74 lines

  1. onClipEvent(enterFrame){
  2.    if(_root._currentframe != 3)
  3.    {
  4.       removeMovieClip(this);
  5.    }
  6.    if(_name != "arrowgen")
  7.    {
  8.       if(move == true)
  9.       {
  10.          _X = _X + run;
  11.          _Y = _Y + rise;
  12.          rise += 0.5;
  13.          _rotation = Math.atan2(rise,run) * 180 / 3.141592653589793;
  14.          if(_Y >= ground)
  15.          {
  16.             move = false;
  17.             gotoAndStop(3);
  18.          }
  19.          for(i in _root.warriors)
  20.          {
  21.             if(_root.warriors[i].side == "right")
  22.             {
  23.                if(_root.warriors[i].hit.hitTest(_X,_Y,true) && _root.warriors[i].health > 0)
  24.                {
  25.                   if(_root.moreDmg == false)
  26.                   {
  27.                      _root.warriors[i].health -= 4;
  28.                   }
  29.                   else
  30.                   {
  31.                      _root.warriors[i].health -= 5;
  32.                   }
  33.                   if(_root.warriors[i].health <= 0)
  34.                   {
  35.                      _root.money += 5;
  36.                   }
  37.                   stuck = true;
  38.                   move = false;
  39.                   tar = i;
  40.                   gotoAndStop(2);
  41.                   break;
  42.                }
  43.                if(_root.warriors[i].hitHead.hitTest(_X,_Y,true) && _root.warriors[i].health > 0)
  44.                {
  45.                   _root.warriors[i].health -= 10;
  46.                   _root.money += 15;
  47.                   stuck = true;
  48.                   move = false;
  49.                   tar = i;
  50.                   gotoAndStop(2);
  51.                   break;
  52.                }
  53.             }
  54.          }
  55.       }
  56.       else
  57.       {
  58.          _alpha = _alpha - 1;
  59.          if(_alpha == 0)
  60.          {
  61.             removeMovieClip(this);
  62.          }
  63.       }
  64.       if(stuck == true)
  65.       {
  66.          if(_root.warriors[tar].health <= 0)
  67.          {
  68.             removeMovieClip(this);
  69.          }
  70.          _X = _root.warriors[tar]._x;
  71.       }
  72.    }
  73. }
  74.